
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <QiMingADXSDK/QiMingADXExpressViewRegisterProtocol.h>
NS_ASSUME_NONNULL_BEGIN
@class QiMingADXNativeExpressAd;
@class QiMingADXNativeExpressView;

@protocol QiMingADXNativeExpressAdDelegate<NSObject>

/**
 信息流广告加载成功
 */
- (void)qimingadxExpressAdSucceedToLoad:(QiMingADXNativeExpressAd *)expressAd views:(NSArray<__kindof UIView<QiMingADXExpressViewRegisterProtocol> *> *)views;

/**
 信息流广告加载失败
 */
- (void)qimingadxExpressAdFailToLoad:(QiMingADXNativeExpressAd *)expressAd error:(NSError *)error;

/**
 信息流广告渲染成功
 */
- (void)qimingadxExpressAdRenderSucceed:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流广告渲染失败
 */
- (void)qimingadxExpressAdRenderFail:(QiMingADXNativeExpressView *)expressAd error:(NSError *)error;

/**
 信息流广告关闭
 */
- (void)qimingadxExpressAdClosed:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流广告点击
 */
- (void)qimingadxExpressAdClick:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流广告展示
 */
- (void)qimingadxExpressAdDidPresent:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流广告曝光
 */
- (void)qimingadxExpressAdDidExpourse:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流广告关闭落地页
 */
- (void)qimingadxExpressAdDidCloseLandingPage:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 *以下为视频信息流相关回调
 */

/**
 信息流视频广告开始播放
 */
- (void)qimingadxExpressAdVideoPlay:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流视频广告视频播放失败
 */
- (void)qimingadxExpressAdVideoPlayFail:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView error:(NSError *)error;

/**
 信息流视频广告视频暂停
 */
- (void)qimingadxExpressAdVideoPause:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;

/**
 信息流视频广告视频播放完成
 */
- (void)qimingadxExpressAdVideoFinish:(QiMingADXNativeExpressAd *)expressAd adView:(UIView<QiMingADXExpressViewRegisterProtocol> *)expressAdView;


@end

@interface QiMingADXNativeExpressAd : NSObject

/**
 *  委托 [必须实现]
 */
@property (nonatomic ,weak) id<QiMingADXNativeExpressAdDelegate>  delegate;

/**
 广告位id
*/
@property (nonatomic, copy) NSString *posId;


/**
 请求超时时间,默认为4s,需要设置3s及以上
*/
@property (nonatomic, assign) NSInteger tolerateTimeout;

/**
 一般为当前展示广告控制器
*/
@property (nonatomic, weak) UIViewController *controller;

/**
 是否设置静音模式，默认是true
*/
@property (nonatomic ,assign) BOOL playMute;

/**
 初始化广告加载器，需传入需要广告尺寸(一般按照16：9比例返回广告视图）
 */
- (instancetype)initWithAdSize:(CGSize)adSize NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)new NS_UNAVAILABLE;

/**
 加载广告

 @param count 拉取几条广告,建议区间 1~4, 超过可能无法拉取到
 */
- (void)loadAdWithCount:(int)count;

/**
 *  竞赢上报，竞价广告位必须在展示前上报
 *
 *  @param adView 竞价成功的广告视图，该广告价格请调用[adView getBidPrice]获取，具体见QiMingADXExpressViewRegisterProtocol，单位：分
 *  @param price 回传广告返回的出价，bidPrice(ecpm)，单位: 分
 */
- (void)sendWinNotificationWithAdView:(UIView<QiMingADXExpressViewRegisterProtocol> *)adView price:(NSInteger)price;

/**
 *  竞败之后调用,
 *  @param reason 竞价失败原因
 *  @param winnerPirce 竟赢者价格，单位：分
 *  @param adView 竞价失败的广告视图
 */
- (void)sendWinFailNotificationReason:(QiMingADXBiddingLossReason)reason winnerPirce:(NSInteger)winnerPirce AdView:(UIView<QiMingADXExpressViewRegisterProtocol> *)adView;

@end

NS_ASSUME_NONNULL_END

